import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'Index',
        redirect: '/home', // 重定向:重新指向其它path,会改变网址
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        children: [{
            path: 'header',
            name: 'Header',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Header.vue')
        }, {
            path: 'list',
            name: 'List',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/List.vue')
        }, {
            path: 'banner',
            name: 'Banner',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Banner.vue')
        }, {
            path: 'goodsList',
            name: 'GoodsList',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/GoodsList.vue')
        }]
    },
    {
        path: '/classfiy',
        name: 'Classfiy',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Classfiy.vue')
    }, {
        path: '/look',
        name: 'Look',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Look.vue')
    }, {
        path: '/shopCar',
        name: 'ShopCar',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/ShopCar.vue')
    }, {
        path: '/my',
        name: 'My',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/My.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router